package com.springboot_shopping.vo;

import lombok.Data;

@Data
public class ResultVo {
    private Integer code;
    private String message;
    private Object data;

    //成功，返回200
    public static ResultVo success(String message,Object data) {
        ResultVo result = new ResultVo();
        result.setCode(200);
        result.setMessage(message);
        result.setData(data);
        return result;
    }

    //失败，返回500
    public static ResultVo error(String message) {
        ResultVo result = new ResultVo();
        result.setCode(500);
        result.setMessage(message);
        return result;
    }
}
